//package com.sx.manage.service.consumer;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import javax.annotation.Resource;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.stereotype.Service;
//
//import com.sx.common.util.NumberUtil;
//import com.sx.manage.service.bank.IMBaseConsumerBankMapService;
//import com.sx.model.CWithdrawEntity;
//import com.sx.model.constants.MSystemConstants;
//import com.sx.model.constants.type.bank.MOutCardType;
//import com.sx.model.manage.mybatis.form.bank.MConsumerBankMapForm;
//import com.sx.model.manage.mybatis.po.bank.MConsumerBankMappingEntityPO;
//import com.sx.model.manage.mybatis.vo.result.ResultBooleanVO;
//import com.sx.service.platform.IPlatformServiceInterface;
///**
// * 自动提现
// * @author lenovo
// *
// */
//@Service("autoTakeMoneyServiceImpl")
//public class MAutoTakeMoneyServiceImpl {
//	// 日志
//	private Logger log = LoggerFactory.getLogger(this.getClass());
//	@Resource(name="platformService")
//	private IPlatformServiceInterface platformServiceImpl;
//	
//	@Resource(name="mBaseConsumerBankMapServiceImpl")
//	private  IMBaseConsumerBankMapService  mBaseConsumerBankMapServiceImpl;
//	
//
//	public IPlatformServiceInterface getPlatformServiceImpl() {
//		return platformServiceImpl;
//	}
//
//	public void setPlatformServiceImpl(IPlatformServiceInterface platformServiceImpl) {
//		this.platformServiceImpl = platformServiceImpl;
//	}
//
//	public ResultBooleanVO tank_money(Long[] consumerIds) {
//		if (null == consumerIds || consumerIds.length ==0) {
//			log.info("没有自动提现用户直接返回{}",NumberUtil.arrayToStr(consumerIds));
//			return  new ResultBooleanVO(false,null,"没有要提现的用户");
//		}
//
//
//		List<CWithdrawEntity> data_list = new ArrayList<>();
//		List<String> error_mess_list = new ArrayList<>();
//		for(int i = 0;i<consumerIds.length;i++){
//			MConsumerBankMapForm form = new MConsumerBankMapForm();
//							     form.setConsumer_id( consumerIds[i]);
//							     form.setConsumer_type( MSystemConstants.CONSUMER_NATURE_PERSON);
//			MConsumerBankMappingEntityPO bankMapPO= mBaseConsumerBankMapServiceImpl.queryConsumerBankMapByForm( form );
//			if (null == bankMapPO.getAccount_no() || "".equals(bankMapPO.getAccount_no())) {
//				//错误信息提示
//				error_mess_list.add(bankMapPO.getBank_consumer_name() );
//			}else{
//				CWithdrawEntity withdraw = new CWithdrawEntity();
//				withdraw.setAccount_no(bankMapPO.getAccount_no());// 摊位号 accountno
//				withdraw.setTrade_mem_code(bankMapPO.getTrade_mem_code());// 交易会员代码
//				withdraw.setOut_account(bankMapPO.getCard_num());// 出金账户（出金卡号）
//				withdraw.setOut_account_name(bankMapPO.getBank_consumer_name());// 出金账户名称（绑卡姓名）
//				withdraw.setRemark1(bankMapPO.getCls_bank_code());// 银行编码
//				withdraw.setBank_name(bankMapPO.getCls_bank_name());// 银行名称
//				withdraw.setCreate_by(String.valueOf(consumerIds[i]));// 用户user_id
//				if(bankMapPO.getCls_bank_name().indexOf("华夏")>=0) {
//					withdraw.setChannel_id("2");// 华夏本行2 他行1
//				}else {
//					withdraw.setChannel_id("1");// 华夏本行2 他行1
//				}
//				if(MOutCardType.OUT_CARD_ONE.equals(bankMapPO.getOut_card_type())) {
//					withdraw.setOut_come_account_type("1");
//				}
//				if(MOutCardType.OUT_CARD_TWO.equals(bankMapPO.getOut_card_type())) {
//					withdraw.setOut_come_account_type("2");
//				}
//				if(MOutCardType.OUT_CARD_THREE.equals(bankMapPO.getOut_card_type())) {
//					withdraw.setOut_come_account_type("3");
//				}
//				data_list.add(withdraw);
//				log.info("自动提现account_no={}",bankMapPO.getAccount_no());
//			}
//		}
//		//错误信息
//		if (!error_mess_list.isEmpty()) {
//			StringBuilder error_mess_str = new StringBuilder();
//			for (int i = 0; i < error_mess_list.size(); i++) {
//				if( i>0 ){
//					error_mess_str.append(",").append(error_mess_list.get(i));
//				}else{
//					error_mess_str.append(error_mess_list.get(i));
//				}
//				
//			}
//			error_mess_str.append("(还没有开通子账户)");
//			return  new ResultBooleanVO(false,null,error_mess_str.toString());
//		}
//		log.info("手工提现开始size={}",data_list.size());
//		boolean b = platformServiceImpl.withdrawList(data_list);
//		if (!b) {
//			return  new ResultBooleanVO(false,null,"手工提现失败，请联系技术人员");
//		}
//		log.info("手工提现完成直接返回{}",NumberUtil.arrayToStr(consumerIds));
//		return new ResultBooleanVO();
//	}
//
//}
//
